package com.itgungnir.diyshuo.activity.load_activity;

import android.os.Bundle;
import android.os.Handler;

import com.itgungnir.diyshuo.activity.R;
import com.itgungnir.diyshuo.activity.main_activity.MainActivity;
import com.itgungnir.diyshuo.base.BaseActivity;
import com.itgungnir.diyshuo.share.SharedData;

public class LoadActivity extends BaseActivity implements LoadContract.View {
    private LoadPresenter presenter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = new LoadPresenter(this);
        initView();
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_load;
    }

    /**
     * 初始化界面布局
     */
    private void initView() {
        // 经过一段时间后跳转到下一个界面
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                goToMain();
            }
        }, SharedData.LOAD_ACTIVITY_LAST_TIME);
    }

    @Override
    public void goToMain() {
        presenter.goToMain(LoadActivity.this, MainActivity.class);
    }
}